import dayjs from "dayjs"
export default {
  data() {
    return {
      columns: [
        {
          propName: "petImg",
          label: "宠物照片",
          slotName: "petImg",
          width: 200
        },
        // {
        //   propName: "id",
        //   label: "编号"
        // },
        {
          propName: "cageName",
          label: "笼子名称"
        },
        {
          propName: "name",
          label: "名字",
          width: 100
        },
        {
          propName: "sex",
          label: "性别",
          width: 100,
          slotName: "sex"
        },
        {
          propName: "birthday",
          label: "生日",
          width: 100,
          formatter: this.formatBirthday
        },
        {
          propName: "size",
          label: "体型",
          width: 100,
          formatter: this.formatSize
        },
        {
          propName: "sterilization",
          label: "绝育情况",
          width: 100,
          formatter: this.formatVaccine
        },
        {
          propName: "",
          label: "操作",
          width: "300",
          slotName: "operation"
        }
      ]
    }
  },
  methods: {
    formatSize({ row }) {
      switch (row.size) {
        case 1:
          return "小型犬"
        case 2:
          return "中型犬"
        default:
          return "大型犬"
      }
    },
    formatVaccine({ row }) {
      switch (row.sterilization) {
        case 0:
          return "未知"
        case 1:
          return "未绝育"
        default:
          return "已绝育"
      }
    },
    formatBirthday({ row }) {
      return dayjs(row.birthday).format("YYYY-MM-DD")
    }
  }
}
